﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MCDomain.DataAccess;
using MCDomain.Model;
using CommonBase;
using McUIBase.ViewModel;

namespace MContracts.ViewModel
{
    public abstract class ContractWorkspaceViewModel : WorkspaceViewModel
    {
        protected ContractWorkspaceViewModel(IContractRepository repository) : base(repository)
        {

        }
        
        public Contractdoc ContractObject
        {
            get
            {
                return WrappedDomainObject as Contractdoc;
            }
            set
            {
                WrappedDomainObject = value;
                OnPropertyChanged(() => ContractObject);
            }
        }

        public Contractdoc GeneralContractObject
        {
            get
            {
                return ContractObject !=null ? ContractObject.OriginalContract : null;
            }
        }

        protected override void Save()
        {
            ContractObject.Do(x => x.UpdateFundsStatistics());
        }
       
    }
}
